// components/my-navBar/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    offsetTop: {
      type: Number,
      value: 0
    },
    leftICon:{
      type: Boolean,
      value: true
    },
    title:{
      type: String,
      value: ""
    },
    info: {
      type: Boolean,
      value: false
    },
    bg: {
      type: String,
      value: "linear-gradient(180deg, #B9EBDF, #CBEFE7)"
    }
  },
  lifetimes: {
    ready(){
      this.data.info && this.createSelectorQuery().select("#myNavBar").boundingClientRect((res => {
        this.triggerEvent('info',res);
      })).exec()
    }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    back() {
      wx.navigateBack({
        fail: () => {
          wx.reLaunch({
            url: '/pages/index/index',
          })
        }
      })
    }
  }
})
